<template>
  <div v-if="activities.length!==0" class="res-activity">
    <div class="activity-txt">
      <span :style="{background:'#'+activities[0].icon_color}">{{activities[0].icon_name}}</span>
      <div>{{activities[0].description}}</div>
    </div>
    <div class="activity-count" @click="clickPullUp">
      <div>{{activities.length}}个优惠</div>
      <i class="fa fa-caret-down"></i>
    </div>
    <van-action-sheet :round="false" v-model="show" title="优惠活动">
      <div class="content_warp">
        <div class="content" v-for="(item,index ) in activities" :key="index">
          <span :style="{background:'#'+item.icon_color}">{{item.icon_name}}</span>
          <div>{{item.description}}</div>
        </div>
      </div>
    </van-action-sheet>
  </div>
</template>

<script>
import { ActionSheet } from "vant";
export default {
  name: "activities",
  components: {
    [ActionSheet.name]: ActionSheet
  },
  props: {
    activities: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {
      show: false
    };
  },
  methods: {
    clickPullUp() {
      this.show = true;
    }
  }
};
</script>

<style scoped>
.res-activity {
  width: 75%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
span {
  padding: 4px;
  color: #fff;
  margin-right: 5px;
}
.activity-txt {
  display: flex;
  align-items: center;
}
.activity-count {
  display: flex;
  align-items: center;
  color: #999;
}
i {
  margin-left: 5px;
}
.content_warp{
  display: flex;
  flex-direction:column;
  padding:0 30px ;
}
.content {
  display: flex;
  margin:5px 0;
  align-items: center;
}

.content:nth-last-of-type(1){
  margin-bottom: 80px;
}
/* /deep/  .van-action-sheet{
  height: 250px;
} */
</style>